Next | Prev | Up | Top | Contents | Index
Determining File Type with file
The file tool lists the properties of program source, text, object, and other files. This tool attempts to identify the contents of files using various heuristics. It is not exact and often erroneously recognizes command files as C programs. For more information, see the file(1) reference page.
file Syntax
The syntax for file is:
file filename1 [filename2...filenamen]
Each filename is the name of a file to be examined.
file Example
Information given by file is self-explanatory for most kinds of files, but using file on object files and executables gives somewhat cryptic output.
file test.o a.out /lib/libc.so.1
test.o: ELF 64-bit MSB relocatable MIPS - version 1
a.out: ELF 64-bit MSB executable MIPS - version 1
/lib/libc.so.1: ELF 64-bit MSB dynamic lib MIPS - version 1
In this example, MSB
indicates Most Significant Byte, also called Big-Endian; relocatable
means the object contains relocation information that allows it to be linked with other objects to form an executable; executable
means an executable file; and dynamic
lib
indicates a DSO.
Next | Prev | Up | Top | Contents | Index